#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys

reload(sys)
sys.setdefaultencoding('utf-8')

for i in sys.stdin:
    t=i.strip().split('\t')
    if len(t)==5:
        cid,sid,day,referer,urls=t
        eps=urls.strip().split(',')
        if len(set(eps[:4]))==4:
            print '\t'.join(map(str,[cid,sid,referer]+eps[:4]+[day]))